package com.lloydfinch.composetour.ui.page

import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

/**
 * Name: Home
 * Author: lloydfinch
 * Function: Home
 * Date: 2021/11/25 10:30 上午
 * Modify: lloydfinch 2021/11/25 10:30 上午
 */

@Preview
@Composable
private fun Home() {
    HomeScreen()
}

@Composable
private fun HomeScreen() {
    Surface(
        color = MaterialTheme.colors.onSurface.copy(alpha = 0.1F),
        contentColor = MaterialTheme.colors.primary,
        shape = MaterialTheme.shapes.small
    ) {
        CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
            Text(
                text = "hello, this a Theme demo",
                modifier = Modifier
                    .fillMaxWidth()
                    .background(Color.LightGray)
                    .padding(horizontal = 16.dp, vertical = 8.dp)
            )
        }
    }
}

@Composable
private fun Test() {

    val derivedColor = MaterialTheme.colors.onSurface.copy(alpha = 0.1F)

    val isLightTheme = MaterialTheme.colors.isLight

    val isDarkTheme = isSystemInDarkTheme()

    FloatingActionButton(
        onClick = { }) {
    }

    // 建议 状态栏 和 底部导航栏 使用 primarySurface颜色
    TopAppBar(backgroundColor = MaterialTheme.colors.primarySurface) {

    }
}